package com.yantong.mapper;

import com.yantong.pojo.ProductDataSku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.HashMap;
import java.util.List;

public interface ProductDataSkuMapper {
	long countByWhere(HashMap<String, Object> map);
	List<ProductDataSku> listByWhere(HashMap<String, Object> map, RowBounds rowBounds);
	List<ProductDataSku> listByWhere(HashMap<String, Object> map);

	List<ProductDataSku> listByWhereDcx(HashMap<String, Object> map);
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_sku
     *
     * @mbg.generated Fri Sep 07 14:30:47 CST 2018
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_sku
     *
     * @mbg.generated Fri Sep 07 14:30:47 CST 2018
     */
    int insert(ProductDataSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_sku
     *
     * @mbg.generated Fri Sep 07 14:30:47 CST 2018
     */
    int insertSelective(ProductDataSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_sku
     *
     * @mbg.generated Fri Sep 07 14:30:47 CST 2018
     */
    ProductDataSku selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_sku
     *
     * @mbg.generated Fri Sep 07 14:30:47 CST 2018
     */
    int updateByPrimaryKeySelective(ProductDataSku record);

    /**
     * 更新库存
     * @param total
     * @param skuId
     * @param version
     * @return
     */
    int changeStock(@Param("total") int total, @Param("skuId") Long skuId, @Param("version") Integer version);

    /**
     * 退还库存
     * @param total
     * @param skuId
     * @return
     */
    int refundStock(@Param("total") int total, @Param("skuId") Long skuId, @Param("version") Integer version);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_sku
     *
     * @mbg.generated Fri Sep 07 14:30:47 CST 2018
     */
    int updateByPrimaryKey(ProductDataSku record);
    
    List<ProductDataSku> selectByProductId(Long productId);
    
    int deleteByProductId(Long productId);
}